Devices that images subjects, such as digital cameras or video cameras, have incorporated techniques that automatically measure the distance to a subject and focus on the subject on the basis of the result of the measurement (so-called autofocus) in order to generate a sharp image of the subject.
Among such autofocus (AF) methods, a phase difference detection method is known as an example of a method that uses light beams passing through an imaging optical system. In the phase difference detection method, a light beam coming from a subject and passing through the imaging optical system is split into two and a displacement of an image sensor from a focus position is determined from the distance between the locations of images of the subject produced by the two light beams on the image sensor. Then the focal point position of the imaging optical system is adjusted so that the locations of the images of the subject produced by the two light beams coincide with each other. In the phase difference detection method, for example, an area where a focus position can be detected by the phase difference detection method is set on the image sensor. Half of each of condenser lenses that is provided on the front of a plurality of solid-state imaging elements arranged in one row included in the area, and perpendicular to the direction in which the solid-state imaging elements are arranged is masked to obtain an image of the subject that corresponds to one of the light beams. Similarly, the other half of each of the condenser lenses that is provided on the front of the plurality of solid-state imaging elements arranged in the other row included in the area, and perpendicular to the direction in which the sold-state imaging elements are arranged is masked to obtain an image of the subject that corresponds to the other of the light beams.
A technique has been proposed that provides a plurality of such areas on an image sensor to enable AF using a phase difference detection method in a plurality of locations in the image sensor (for example, see Japanese Laid-open Patent Publication No. 2007-24941). In the technique disclosed in Japanese Laid-open Patent Publication No. 2007-24941, when a focus position in an area of interest in which focal point detection using the phase difference detection method may not be performed on the image sensor is to be detected, a defocus amount is obtained in each of a plurality of areas, which is near the area of interest and in which focal point detection using the phase difference detection method can be performed. Then the average of the obtained defocus amounts is used as an estimated defocus amount in the area of interest.